package com.apartment.dao;

import com.apartment.data.entity.Admin;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Author : xuzhiyong
 * Date : 2022/5/30 11:39
 */
public interface AdminDao extends JpaRepository<Admin,Integer> {
    Admin findByUsernameAndPassword(String username, String password);

    @Query(value = "SELECT a.id,a.username,a.password from Admin a where a.username like ?1",nativeQuery = true)
    List<Admin> findAdminByUsername(String username);

    @Query(value = "SELECT a.id,a.username,a.password from Admin a where a.username like ?1",nativeQuery = true)
    Admin findAdminByUsername1(String username);

    @Query(value = "select * from Admin a where a.mail like ?1",nativeQuery = true)
    Admin findAdminByMail(String mail);
}
